# 用户访问量 客户端地址： x.x.x.x   访问次数： xx

# 定义空字典 

count = {}


# 读取日志文件
weblog = r"E:\python\test\实例\access_log"
with open(weblog, "r") as f:
    for line in f:
        # 获取客户端地址
        client_ip = line.split()[0]
        if client_ip in count:
            count[client_ip] += 1
        else:
            count[client_ip] = 1
    for k, v in count.items():
        print("客户端地址： %s   访问次数： %s" % (k,v) )    
        
